<template>
    <div>
        <div class="space20"></div>
        <el-form :inline="true" class="demo-form-inline">
            <el-form-item>

            </el-form-item>
            <el-form-item label="汇率">
                {{huilv}}
            </el-form-item>
            <el-form-item label="应赔付">
                ¥ {{money}}
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">确认支付</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
export default {
    data() {
        return {
            money: '',
            huilv: ''
        }
    },
    methods: {
        onSubmit: function() {
            var url;
            if (this.$route.query["DutyType"] == "医疗保险") {
                url = "Bill/PayOk?id=" + this.$route.query["id"] + "&huilv=" + this.huilv;
            } else {
                url = "ResultOther/Pay?huilv=" + this.$route.query["huilv"] + "&id=" + this.$route.query["id"] + "&type=" + this.$route.query["DutyType"];
            }
            this.$http.get(url).then(response => {
                var data = response.body;
                if (data.code == 1) {
                    this.$notify.success({
                        title: '成功',
                        message: '确认成功'
                    });
                    this.$router.go(-1);
                } else {
                    this.$notify.error({
                        title: '失败',
                        message: '确认失败'
                    })

                }
            }, response => {
                this.$notify.error({
                    title: '网络错误',
                    message: '网络错误'
                });

            });
        }
    },
    activated() {
        this.huilv = this.$route.query["huilv"];
        var url;
        if (this.$route.query["DutyType"] == "医疗保险") {
            url = "Result_People/People?huilv=" + this.$route.query["huilv"] + "&id=" + this.$route.query["id"];
        } else {
            url = "ResultOther/People?huilv=" + this.$route.query["huilv"] + "&id=" + this.$route.query["id"] + "&type=" + this.$route.query["DutyType"];
        }


        this.$http.get(url).then(response => {
            var data = response.body;
            if (data.code == 1) {
                this.money = data.msg;

            } else {

                this.$notify.error({
                    title: '失败',
                    message: '确认失败'
                })

            }
        }, response => {
            this.$notify.error({
                title: '网络错误',
                message: '网络错误'
            });
            this.loding = false;
        });
    }
}
</script>
